<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="utf-8">
		<title>后台管理</title>
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
		
		<link href="https://cdn.bootcss.com/bootstrap-fileinput/4.3.8/css/fileinput.min.css" rel="stylesheet">
		
		<link rel="stylesheet" type="text/css" th:href="@{/css/backindex.css}">
		
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
			<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
		<![endif]-->
	</head>
	<body>
		<div th:replace="back/cartoon :: leftbar"></div>

		<div class="content">
			<div th:replace="back/cartoon :: navbar"></div>
			
			<ol class="breadcrumb">
			  <li><a th:href="@{/admin/cartoon}">漫画管理</a></li>
			  <li class="active" th:inline="text">[[${c.name!=null?"修改漫画":"添加漫画"}]]</li>
			</ol>
			
			
			<div class="well">

				
				<div class="panel panel-default">
					<div class="panel-body">
						<form th:action="@{/cartoon}"  class="form-horizontal" method="POST" enctype="multipart/form-data" data-toggle="validator" role="form" data-focus="false">
		  		   
		  					
		  		    	<div class="form-group">
		  		    		<label for="" class="col-xs-2 control-label">漫画名称：</label>
		  		    		<div class="col-xs-3">
		  		    			<input th:value="${c.name}" type="text" class="form-control"  name="name" required="required" data-error="名称不能为空">
		  		    		</div>
		  		    		<div class="help-block with-errors col-xs-5"></div>
		  		    	</div>
		  						
		  		    	<div class="form-group">
		  		    		<label for="" class="col-xs-2 control-label">漫画类型：</label>
		  		    		<div class="col-xs-2">
		  		    			<select name="tpId" id="typic" class="form-control" required="required" data-error="类型不能为空">
		  		    				<option value=""></option>
		  		    				<option th:each="t:${types}" th:value="${t.id}">[[${t.name}]]</option>
		  		    			</select>
		  		    		</div>
		  		    		<div class="help-block with-errors col-xs-5"></div>
		  		    	</div>
		
		  		    	<div class="form-group">
		  		    		<label for="" class="col-xs-2 control-label">作者：</label>
		  		    		<div class="col-xs-3">
		  		    			<input th:value="${c.author}" type="text" class="form-control" id="author" name="author">
		  		    		</div>
		  		    	</div>
		  						
		  		    	<div class="form-group ">
		  		    		<label for="" class="col-xs-2 control-label">状态：</label>
		  		    		<div class="col-xs-3 radio" style="margin-bottom:7px;">
			  		    		<label><input checked="checked" type="radio" name="statu" id="input" value="true">完结</label>&nbsp;&nbsp;&nbsp;&nbsp;
			  		    		<label><input th:checked="!${c.statu}" type="radio" name="statu" id="input" value="false" checked>连载中</label>
		  		    		</div>
		  		    	</div>
		  		    		
		  		    	<div class="clearfix">
		  		    			<div class="form-group col-xs-6">
		  		    			<label for="" class="col-xs-4 control-label">漫画头像：</label>
		  		    			<div class="col-xs-8 pic">
		  		    				<input id="ctImg"  name="ctImg" type="file" class="file" >
		  		    			</div>
		  		    		</div>
		  					<div class="form-group col-xs-6">
		  						<label for="" class="col-xs-3 control-label">漫画图片：</label>
		  		    			<div class="col-xs-8">
		  		    				<input id="ctPic" name="ctPic" type="file" class="file"  >
		  		    			</div>
		  		    		</div>
		  		    	</div>
		  		    		
		  		    		
		  		    	
		  						
		  		    	<div class="form-group">
		  		    		<label for="" class="col-xs-2 control-label">漫画简介：</label>
		  		    		<div class="col-xs-8">
		  		    			<input th:value="${c.msg}" type="text" class="form-control" name="msg">
		  		    		</div>
		  		    	</div>
		  						
		  		    	<div class="form-group">
		  		    		<label for="" class="col-xs-2 control-label">漫画介绍：</label>
		  		    		<div class="col-xs-8">
		  		    			<textarea th:text="${c.info}" name="info" class="form-control" rows="5"></textarea>
		  		    		</div>
		  		    	</div>
		  		    	<input name="img" th:value="${c.img}" type="hidden">
		  		    	<input name="pic" th:value="${c.pic}" type="hidden">
		  		    	<input name="_method" value="PUT" type="hidden" th:if="${c.name!=null}"/>
		  		    	<input name="id" th:value="${c.id}" type="hidden">
		  		    	<div class="form-group text-center">
		  		    		 <button type="submit" class="btn btn-primary">提交</button>
		  		 			 <button type="reset" class="btn btn-default">清空</button>
		  		    	</div>
		  		    	
		  		    	</form>
		  		    	
					</div>
				</div>
				
			</div>

		</div>
		

		
		
		
		<!-- jQuery -->
		 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
		<!-- Bootstrap JavaScript -->
		<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
	
		<script src="https://cdn.bootcss.com/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap-fileinput/4.3.8/js/fileinput.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap-fileinput/4.3.9/js/locales/zh.min.js"></script>
		
		<script th:src="@{/js/backindex.js}" type="text/javascript"></script>
		
		
		<script type="text/javascript" th:inline="javascript">
		var c=[[${c}]];
		var config={
			language: 'zh',
			overwriteInitial: true,
		    maxFileSize: 1500,
		    showClose: false,
		    showCaption: false,
		    layoutTemplates: {main2: '{preview} {remove} {browse}'},
		    allowedFileExtensions: ["jpg", "png", "gif"],
		    initialPreview:[],
  			initialPreviewConfig:[]
 		   }

		if(c.name!=null && c.name.length!=0){
			$('#typic').val(c['tpId'])
			if(c.img!=null && c.img.length!=0){
				config['initialPreview']=['<img src="'+c['img']+'" class="file-preview-image" style="height:160px;">']
				config['initialPreviewConfig']=[{caption:'img.jpg',showDelete:false}]	
			}
			$('#ctImg').fileinput(config)
			if(c.pic!=null && c.pic.length!=0){
				config['initialPreview']=['<img src="'+c['pic']+'" class="file-preview-image" style="height:160px;">']
				config['initialPreviewConfig']=[{caption:'pic.jpg',showDelete:false}]
			}else{
				config['initialPreview']=[];
				config['initialPreviewConfig']=[];
			}
			$('#ctPic').fileinput(config)
		}else{
			$(':file').fileinput(config)
		}
		
		$('.file-preview').removeClass('file-preview')			
		</script>
	</body>
</html>